package WaiBao;

import java.util.Arrays;

public class RenYaXin {
    public static void main(String[] args) {
        String[] name = {"叶思存(班长)", "李白(副班长)", "小李(学习委员)", "李贺(体育委员)", "洪金宝", "范冰冰", "李冰冰", "文天祥", "陈独秀", "李大钊", "张正义", "唐艺昕",
                "景甜", "邓超", "李晨", "陈赫", "李沉舟", "李佳航", "娄艺潇", "王建军", "王文君", "王建强", "张行者", "张信哲", "张杰", "谢娜", "何炅", "和美家",
                "杜海涛", "任雅欣(学生)"};//考生本人:任雅欣(学生)
        int[] age = {20, 21, 22, 19, 20, 20, 18, 21, 19,20, 18, 19, 19, 20, 21, 19, 18, 19, 18, 20, 20, 19, 20, 20, 20, 19, 20, 20, 20, 19};//考生年龄：19

        double[] you1 = {80, 78, 85, 88, 81, 64, 78, 59, 61, 80, 97, 87, 85, 74, 60, 68, 68, 99, 96, 88, 92, 91, 95, 85, 75, 74, 74, 84, 91, 95};
        double[] you2 = {94, 84, 67, 84, 74, 80, 84, 99, 80, 90, 80, 97, 86, 70, 65, 65, 86, 79, 76, 78, 82, 71, 83, 85, 75, 82, 75, 79, 71, 95};
        double[] you3 = {64, 89, 71, 65, 89, 75, 69, 69, 80, 64, 93, 87, 85, 85, 65, 98, 89, 79, 96, 63, 92, 81, 95, 85, 76, 88, 73, 74, 74, 95};


        double winter1;//代表每个学生的总分
        double winter2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            winter1 = you1[i] + you2[i] +you3[i];
//            winter2= (winter1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + winter1);
//            System.out.println(name[i] + "的平均分为:" + winter2);
//        }


        double navicat1 = 0, navicat2 = 0;
        double[] love = new double[30];
//        for (int i = 0; i < 30; i++) {
//            navicat1 = you1[i] + you2[i] + you3[i];
//            navicat2 = ( navicat1 * 1.0) / 3;
//            love[i] = navicat2;
//        }
//
//        for (int i = 0; i < love.length - 1; i++) {
//            for (int j = 0; j <love.length - i - 1; j++) {
//                if (love[j] < love[j + 1]) {
//                    double temp =love[j];
//                    love[j] = love[j + 1];
//                    love[j + 1] = temp;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(love[i]);
//        }




        double houlai1 = 0,houlai2 = 0, houlai3 = 0;//计算每门课的平均分
        double women1 = 0,women2 = 0,women3 = 0;//计算每门课标准差
        double zhizuo1 = 0, zhizuo2 = 0, zhizuo3 = 0;//计算每门课中位数
        double sum2 = 0;
//        for (int i = 0; i < you1.length; i++) {
//            sum2+=you1[i];
//        }
//        houlai1 = (sum2*1.0)/30;
//        System.out.println("分析化学的班级平均分为:"+houlai1);
//        double Sum = 0;
//        for (int i = 0; i <you2.length; i++) {
//            Sum+=you2[i];
//        }
//        houlai2 = (Sum*1.0)/30;
//        System.out.println("线性代数的班级平均分为:"+houlai2);
//        double sum = 0;
//        for (int i = 0; i <you3.length; i++) {
//            sum+=you3[i];
//        }
//        houlai3 = (sum*1.0)/30;
//        System.out.println("有机化学的班级平均分为:"+houlai3);
//
//        double c1 = 0,c2 = 0,c3 = 0;
//        for (int i = 0; i < you1.length; i++) {
//            c1+= (you1[i] -houlai1)*(you1[i] -houlai1);
//        }
//        women1 = Math.sqrt(c1*1.0/30);
//        System.out.println("分析化学的班级标准差为:"+ women1);
//
//        for (int i = 0; i < you2.length; i++) {
//            c2+= (you2[i] -houlai2)*(you2[i] - houlai2);
//        }
//        women2 = Math.sqrt(c2*1.0/30);
//        System.out.println("线性代数的班级标准差为:"+ women2);
//
//        for (int i = 0; i <you3.length; i++) {
//            c3+= (you3[i] -houlai3)*(you3[i] - houlai3);
//        }
//        women3 = Math.sqrt(c3*1.0/30);
//        System.out.println("有机化学的班级标准差为:"+ women3);
////
////
        Arrays.sort(you1);
        Arrays.sort(you2);
        Arrays.sort(you3);
        zhizuo1 =( you1[14]+you1[15])*1.0/2;
        zhizuo2 =(you2[14]+you2[15])*1.0/2;
        zhizuo3 =(you3[14]+you3[15])*1.0/2;
        System.out.println("分析化学的中位数为:"+zhizuo1);
        System.out.println("线性代数的中位数为:"+zhizuo2);
        System.out.println("有机化学的中位数为:"+zhizuo3);





    }
}
